home *** CD-ROM | disk | FTP | other *** search
/ QuickTime 1.0 for Developers / QuickTime 1.0 for Developers.iso / Programming Stuff / Interfaces / Oldstyle C Interfaces / Components.h < prev    next >
C/C++ Source or Header  |  1991-09-06  |  8KB  |  210 lines

  1.  
  2. /* Component Manager.h
  3.     Interface to the Movies Component Manager
  4.  
  5.     by Jim Batson, Bruce Leak, David Van Brink
  6.     Copyright 1990 Apple Computer, Inc. All rights reserved.
  7. */
  8.  
  9. #ifndef _Components_
  10. #define _Components_
  11.  
  12. #include <Memory.h>
  13.  
  14. #ifndef kSmallestArray
  15.     #define kSmallestArray 1
  16. #endif
  17.  
  18. #define gestaltComponentMgr 'cpnt'
  19.  
  20. typedef struct
  21.     {
  22.     unsigned long componentType;            /* A unique 4-byte code indentifying the command set */
  23.     unsigned long componentSubType;            /* Particular flavor of this instance */
  24.     unsigned long componentManufacturer;    /* Vendor indentification */
  25.     unsigned long componentFlags;            /* 8 each for Component,Type,SubType,Manuf/revision */
  26.     unsigned long componentFlagsMask;        /* Mask for specifying which flags to consider in search, zero during registration */
  27.     } ComponentDescription;
  28.  
  29.  
  30. typedef struct
  31.     {
  32.     unsigned long type;                    /* 4-byte code     */
  33.     short id;                            /*              */
  34.     } ResourceSpec;
  35.  
  36.  
  37. typedef struct
  38.     {
  39.     ComponentDescription td;                /* Registration parameters */
  40.     ResourceSpec component;                    /* resource where Component code is found */
  41.     ResourceSpec componentName;                /* name string resource */
  42.     ResourceSpec componentInfo;                /* info string resource */
  43.     ResourceSpec componentIcon;                /* icon resource */
  44.     } ComponentResource;
  45.  
  46.  
  47. #ifndef _PrivateThingManager_
  48.     typedef struct privateComponentRecord *Component;
  49.     typedef struct privateComponentInstanceRecord *ComponentInstance;
  50. #endif _PrivateThingManager_
  51.  
  52.  
  53. /*  Structure received by Component:        */
  54.  
  55. typedef struct
  56.     {
  57.     unsigned char flags;                /* call modifiers: sync/async, deferred, immed, etc */
  58.     unsigned char paramSize;            /* size in bytes of actual parameters passed to this call */
  59.     short what;                            /* routine selector, negative for Component management calls */
  60.     long params[kSmallestArray];        /* actual parameters for the indicated routine */
  61.     } ComponentParameters;
  62.  
  63.  
  64. typedef long ComponentResult;
  65.  
  66. #if THINK_C == 1
  67.     typedef ComponentResult (*ComponentRoutine)
  68.             (ComponentParameters *tp, Handle componentStorage );
  69.     
  70.     typedef ComponentResult (*ComponentFunction)();
  71. #else
  72.     typedef pascal ComponentResult (*ComponentRoutine)
  73.             (ComponentParameters *tp, Handle componentStorage );
  74.     
  75.     typedef pascal ComponentResult (*ComponentFunction)();
  76. #endif
  77.  
  78.  
  79. #define ComponentCallNow( callNumber, paramSize ) \
  80.         {0x2f3c,paramSize,callNumber,0x7000,0xA82A}
  81.  
  82.  
  83. /********************************************************
  84. *                                                        *
  85. *                  APPLICATION LEVEL CALLS                    *
  86. *                                                        *
  87. ********************************************************/
  88.  
  89. /********************************************************
  90. * Component Database Add, Delete, and Query Routines 
  91. ********************************************************/
  92.  
  93. pascal Component RegisterComponent(ComponentDescription *td, ComponentRoutine componentEntryPoint, short global, Handle componentName, Handle componentInfo, Handle componentIcon)
  94.         = {0x7001,0xa82a};
  95. pascal Component RegisterComponentResource(ComponentResource **tr, short global)
  96.         = {0x7012,0xa82a};
  97. pascal OSErr UnregisterComponent(Component aComponent)
  98.         = {0x7002,0xa82a};
  99.  
  100. pascal Component FindNextComponent(Component aComponent, ComponentDescription *looking)
  101.         = {0x7004,0xa82a};
  102. pascal long CountComponents(ComponentDescription *looking)
  103.         = {0x7003,0xa82a};
  104.  
  105. pascal OSErr GetComponentInfo(Component aComponent, ComponentDescription *td, Handle componentName, Handle componentInfo, Handle componentIcon)
  106.         = {0x7005,0xa82a};
  107. pascal long GetComponentListModSeed( )
  108.         = {0x7006,0xa82a};
  109.  
  110. /********************************************************
  111. * Component Instance Allocation and dispatch routines 
  112. ********************************************************/
  113.  
  114. pascal ComponentInstance OpenComponent(Component aComponent)
  115.         = {0x7007,0xa82a};
  116. pascal OSErr CloseComponent(ComponentInstance aComponentInstance)
  117.         = {0x7008,0xa82a};
  118.  
  119. pascal OSErr GetComponentInstanceError(ComponentInstance aComponentInstance)
  120.         = {0x700a,0xa82a};
  121.  
  122. /* direct calls to the Components */
  123.  
  124. pascal long ComponentFunctionImplemented(ComponentInstance ti, short ftnNumber) = {0x2f3c,2,0xfffd,0x7000,0xa82a};
  125. pascal long GetComponentVersion(ComponentInstance ti) = {0x2f3c,0,0xfffc,0x7000,0xa82a};
  126.  
  127.  
  128. /********************************************************
  129. *                                                        *
  130. *                      CALLS MADE BY ComponentS                  *
  131. *                                                        *
  132. ********************************************************/
  133.  
  134. /********************************************************
  135. * Required Component routines
  136. ********************************************************/
  137.  
  138. #define kComponentOpenSelect     -1            /* ComponentInstance for this open */
  139. #define kComponentCloseSelect     -2            /* ComponentInstance for this close */
  140. #define kComponentCanDoSelect     -3            /* selector # being queried */
  141. #define kComponentVersionSelect     -4            /* no params */
  142. #define kComponentRegisterSelect -5            /* no params */
  143. #define kComponentTargetSelect      -6            /* ComponentInstance for top of call chain */
  144.  
  145. /********************************************************
  146. * Component Management routines
  147. ********************************************************/
  148.  
  149. pascal void SetComponentInstanceError(ComponentInstance aComponentInstance, OSErr theError)
  150.         = {0x700b,0xa82a};
  151.  
  152. pascal long GetComponentRefcon(Component aComponent)
  153.         = {0x7010,0xa82a};
  154. pascal void SetComponentRefcon(Component aComponent, long theRefcon)
  155.         = {0x7011,0xa82a};
  156.  
  157. pascal short OpenComponentResFile(Component aComponent)
  158.         = {0x7015,0xa82a};
  159. pascal OSErr CloseComponentResFile(short refnum)
  160.         = {0x7018,0xa82a};
  161.  
  162. /********************************************************
  163. * Component Instance Management routines
  164. ********************************************************/
  165.  
  166. pascal Handle GetComponentInstanceStorage(ComponentInstance aComponentInstance)
  167.         = {0x700c,0xa82a};
  168. pascal void SetComponentInstanceStorage(ComponentInstance aComponentInstance, Handle theStorage)
  169.         = {0x700d,0xa82a};
  170.  
  171. pascal long GetComponentInstanceA5(ComponentInstance aComponentInstance)
  172.         = {0x700e,0xa82a};
  173. pascal void SetComponentInstanceA5(ComponentInstance aComponentInstance, long theA5)
  174.         = {0x700f,0xa82a};
  175.  
  176. pascal long CountComponentInstances(Component aComponent)
  177.         = {0x7013,0xa82a};
  178. pascal ComponentInstance FindNextCommonComponentInstance(ComponentInstance ti, Component t, ComponentRoutine commonEntryPoint)
  179.         = {0x7014,0xa82a};
  180.  
  181. /* useful helper routines for convenient method dispatching */
  182.  
  183. pascal long CallComponentFunction(ComponentParameters *params, ComponentFunction ) = {0x70FF,0xA82A};
  184. pascal long CallComponentFunctionWithStorage(Handle storage, ComponentParameters *params, ComponentFunction ) = {0x70FF,0xA82A};
  185.  
  186. pascal long DelegateComponentCall( ComponentParameters *originalParams, ComponentInstance ti ) = {0x7024,0xA82A};
  187.  
  188. enum {                /* Set Default Component flags */
  189.     defaultComponentIdentical        = 0,
  190.     defaultComponentAnyFlags        = 1,
  191.     defaultComponentAnyManufacturer    = 2,
  192.     defaultComponentAnySubType        = 4
  193.     };
  194.     
  195. #define defaultComponentAnyFlagsAnyManufacturer defaultComponentAnyFlags+defaultComponentAnyManufacturer
  196. #define defaultComponentAnyFlagsAnyManufacturerAnySubType  defaultComponentAnyFlags+defaultComponentAnyManufacturer+defaultComponentAnySubType
  197.  
  198. pascal OSErr SetDefaultComponent( Component aComponent, short flags )
  199.         = {0x701e,0xa82a};
  200. pascal ComponentInstance OpenDefaultComponent( long componentType, long componentSubType )
  201.         = {0x7021,0xa82a};
  202.  
  203. pascal Component CaptureComponent( Component capturedComponent, Component capturingComponent )
  204.         = {0x701c,0xa82a};
  205. pascal OSErr UncaptureComponent( Component aComponent )
  206.         = {0x701d,0xa82a};
  207.  
  208. #endif _Components_
  209.  
  210.